﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace LibraryManagement.Sach
{
    public partial class frmSua : DevExpress.XtraEditors.XtraForm
    {
        private SachBus busS;
        private uscSach uscDS;
        private DauSachDto dtoDS;

        internal DauSachDto DtoDS
        {
            get { return dtoDS; }
            set { dtoDS = value; }
        }

        internal SachBus BusDS
        {
            get { return busS; }
            set { busS = value; }
        }        

        public uscSach UscDS
        {
            get { return uscDS; }
            set { uscDS = value; }
        }

        public frmSua()
        {
            InitializeComponent();
        }

        private void btnCat_Click(object sender, EventArgs e)
        {
            DauSachDto dtoDS = new DauSachDto();
            dtoDS.MaDauSach = txtMa.Text;
            dtoDS.Ten = txtTen.Text;
            busS.Sua(dtoDS);
            uscDS.dgvDauSach.DataSource = busS.layDuLieuDGV(); 
        }

        private void btnHuyBo_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        
        private void frmSua_Load(object sender, EventArgs e)
        {
            txtMa.Text = dtoDS.MaDauSach;
            txtTen.Text = dtoDS.Ten;
        }
    }
}